
import React,{Component} from 'react';
const echarts = require('echarts');

export  class BarChart extends Component{
    constructor(props){
        super(props);
        this.state={};
    }
    componentDidMount(){
        let myChart = echarts.init(this.domIns);
        this.setState({myChart});
    }
    render(){
        let myoption = {};
        if(this.props.option){
            myoption = {...this.props.option};
            myoption.textStyle={
                fontFamily : 'SimHei'
            }
        }
        this.state.myChart && this.props.option && this.state.myChart.setOption(myoption);
        return(
            <div  style = {this.props.style} ref = {(ins)=>{
                this.domIns = ins;
            }}>
            </div>
        )
    }
}